package com.moyun.zbmy.zizhou.ui.adapter.holder;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.GridLayout;
import android.widget.GridView;

import com.moyun.zbmy.zizhou.R;
import com.moyun.zbmy.zizhou.beans.SubscriptionNoListBean;
import com.moyun.zbmy.zizhou.beans.SubscriptionNoTypeList;
import com.moyun.zbmy.zizhou.ui.adapter.SubscriptionNoAdapter;
import com.moyun.zbmy.zizhou.ui.adapter.SubscriptionNoHomeTypeAdapter;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 部门乡镇搜索结果--订阅号
 */
public class SearchSubscriptionNoListHolder extends BaseAbsHolder<SubscriptionNoListBean> {

    @BindView(R.id.subscription_no_search_list)
    protected RecyclerView sucriptionNoListView;
    @BindView(R.id.bottom_line)
    protected View bottom_line;



    private SubscriptionNoListBean temp;
    private SubscriptionNoAdapter.OnSubscriptionNoClickListener clickListener;

    public SearchSubscriptionNoListHolder(Context context, View itemView,  SubscriptionNoAdapter.OnSubscriptionNoClickListener clickListener) {
        super(context, itemView);
        this.clickListener = clickListener;
    }


    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(SubscriptionNoListBean t) {
        temp = t;
        if(t.isShowBottom()) {
            bottom_line.setVisibility(View.VISIBLE);
        }else{
            bottom_line.setVisibility(View.GONE);
        }
        GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 4);
        //设置RecycleView显示的方向是水平还是垂直 GridLayout.HORIZONTAL水平  GridLayout.VERTICAL默认垂直
        gridLayoutManager.setOrientation(GridLayout.VERTICAL);
        //设置布局管理器， 参数gridLayoutManager对象
        sucriptionNoListView.setLayoutManager(gridLayoutManager);
        SubscriptionNoAdapter adapter = new SubscriptionNoAdapter(context, t.getSubscriptionNoList(), clickListener);
        sucriptionNoListView.setAdapter(adapter);
    }

    @Override
    public void setItemMode(int mode) {
        super.setItemMode(mode);

    }

    @Override
    public void onDestory() {
        super.onDestory();

    }

}
